home *** CD-ROM | disk | FTP | other *** search
-
- Show MS-DOS Device Drivers in a System.
-
- Written by John Porter, Blue Flamingo Software, March 1989.
- This material is submitted to the Public Domain, inasmuch as
- Microsoft Corporation reserves the rights to all of its proprietary
- information and copyrighted material.
-
- Files included:
- SHOWDEVS.DOC
- SHOWDEVS.C
- GETLOL.C
- GETLOL.ASM
- SHOWDEVS.MK
- SHOWDEVS.EXE
-
- The purpose of this program is to ouput a list of the device drivers
- currently active in a (MS-DOS) system.
-
- Each device driver consists of a header (an eighteen-byte structure), and bunch
- of other stuff (code). The FIRST item in the header is a pointer to the header
- of the next driver in the chain. Other items in the header are the device
- attribute word; the name of the device; the offsets of the strategy and
- interrupt routines (the code that implements the driver).
-
- Thus it is easy to display the info for a driver and to find the next driver
- in the chain; the trick is to find the FIRST driver. There are two ways to
- do this. One utilizes the fact that the first driver in the chain is ALWAYS
- the NUL device (at least through MS-DOS version 3.3). This method searches
- from the bottom of ram for the name 'NUL'; and then assumes that this is in
- the header of the first driver. This method has the disadvantages of being
- dependent on the fact that the first driver is always named NUL, and by
- searching willy-nilly for text, is hardly failsafe. Of course, more validity
- checks could be added, at the expense of program complexity.
-
- Another method is to utilize the fact that the device driver chain is
- maintained by DOS in memory just after the List of Lists; this is the structure
- which DOS uses to locate other global information, such as the head of the
- Memory Control Block chain, and the head of the Disk Block chain. Some
- complexity is added by the fact that the length of the List of Lists is
- different for versions 2.xx and 3.xx (and probably 4.xx also). The length is
- 17h for versions 2.xx, and 22h for versions 3.xx. I have assumed in my sample
- program that the DOS version is 3.xx. You may change this, or a routine may
- be easily added to determine which version of DOS the program is running under.
- To find the List of Lists easily, call the undocumented DOS function 52h.
- This returns the address of the List of Lists in ES:BX. The disadvantage of
- this is obvious: Microsoft always threatens to change these things without
- notice. (Some of us DO notice.) However, if you're running MS-DOS version
- 2.xx or 3.xx, function 52h works. Anyone know about 4.xx, or OS\2?
-
- The last driver in the chain uses a signed value of -1 in the
- Pointer-to-Next-Driver field of the header, to indicate that it is the last.
-
- The main program is in SHOWDEVS.C; the function getlol() (Get List of Lists)
- is defined in two ways: a C version and an assembler version, in GETLOL.C
- and in GETLOL.ASM, respectively. You can use SHOWDEVS.MK to create the file
- SHOWDEVS.EXE. This makefile assumes that GETLOL.ASM is going to be used.
-
- Note that SHOWDEVS.EXE as supplied with this package should only be run if you
- know that you are using MS-DOS version 3.xx.
-
-
- I used Microsoft C v. 5.1, and Microsoft Macro Assembler v. 5.1.
- N.B. copyrights held by Microsoft Corporation.
-
- For more detailed information on the structure and operation of device drivers,
- try these books:
-
- Advanced MS-DOS, Ray Duncan, Microsoft Press 1986,1988
-
- MS-DOS Developer's Guide, The Waite Group,
- Howard Sams and Co., 1988
-
- Credit and thanks go to The Waite Group and Howard Sams & Co. for
- documenting the undocumented.
-
- If you have any questions, problems, or comments, you may reach me at:
-
- CompuServe 70441,214
- Genie J.PORTER5
-
-